      SUBROUTINE ATTUDE(TSTOP,TIME,FREQ,DELTAT,JPLUSE,LSAVE,JUMP)
C
C        'ATTUDE' DETERMINES THE START AND STOP TIME OF THRUSTING FOR
C        THE ATTITUDE CONTROL SYSTEM. IT ALSO SETS THE INTEGRATION TIME
C        STEP DURING THE THRUSTING OPERATION
C
        IMPLICIT REAL*8 (A-H,O-Z)
      INTEGER*4 ACNTRL
C
      COMMON/CONSTS/ PI,TWOPI,RADIAN
C
      COMMON/MOMENT/ ACNTRL,IVISCS,IATTDE,IMGMTS,IWHEEL,NPULSE
C
      COMMON/OUTONE/ OMEGL,VSUBL,ASUBM(3),CMX1,SIMPX,SB(3)
C
      COMMON/RATTDE/ DTMXA,PXI,PXO,EIT,REFTIM,TMX1,TMX2,CMX,ISW
C
C
      DATA N /0/
C
      IF(JUMP.EQ.1) GO TO 10
      IF(TIME.LT.TMX1) RETURN
   10 GO TO (20,30,40),JUMP
   20 N=N+1
      JUMP=2
      TSAVE=TSTOP
      FSAVE=FREQ
      DSAVE=DELTAT
      TSTOP=TMX1
      FREQ=TMX1 - REFTIM
      FREQ=DMIN1(FREQ,FSAVE)
      DELTAT=DMIN1(FREQ/4.D0,DSAVE)
      REFTIM=0.D0
      TS=DMOD(TSTOP,8.64D4)
      TS=HMSOUT(TS)
      WRITE(6,10000) N,TS
      WRITE(6,10003) FREQ,DELTAT
      RETURN
C
C
   30 JUMP=3
      TSTOP=TMX2
      FREQ=TMX2 - TMX1
      FREQ=DMIN1(FREQ,FSAVE)
      DELTAT=DMIN1(FREQ/4.D1,DSAVE)
      LSAVE=1
      SIMPX=SIMPX + FREQ*CMX
      TS=DMOD(TSTOP,8.64D4)
      TS=HMSOUT(TS)
      WRITE(6,10001) TS
      WRITE(6,10003) FREQ,DELTAT
      IF(NPULSE.LE.0.OR.TSTOP.LE.TSAVE) RETURN
      TS=DMOD(TSAVE,8.64D4)
      TSAVE=TSAVE + FSAVE
      TS1=DMOD(TSAVE,8.64D4)
      WRITE(6,10004) TS,TS1
      RETURN
C
C
   40 IF(TIME.LT.TMX2) RETURN
      JUMP=1
      NPULSE=NPULSE - 1
      ISW=0
      FREQ=FSAVE
      DELTAT=DSAVE
      TSTOP=TSAVE
      ACNTRL=0
      LSAVE=1
      IF(NPULSE.EQ.0) IATTDE=0
      TS=DMOD(TSTOP,8.64D4)
      TS=HMSOUT(TS)
      WRITE(6,10002) TS
      WRITE(6,10003) FREQ,DELTAT
      RETURN
C
C
10000 FORMAT('0',10X,'ATTITUDE CONTROL ON FOR PULSE ',I3/11X,
     .               'INTEGRATING TO LEADING EDGE OF PULSE  ',F10.3)
C
10001 FORMAT('0',10X,'INTEGRATING TO TRALING EDGE OF PULSE  ',F10.3)
C
10002 FORMAT('0',10X,'ATTITUDE CONTROL OFF'/11X,
     .               'CONTINUING PROBLEM TO  ',F10.3)
C
10003 FORMAT('0',10X,'WITH A PRINT FREQUENCY OF',F8.3/11X,
     .               'AND DELTA-TIME EQUAL TO',G20.8)
C
10004 FORMAT('0',30X,'THE STOP TIME FOR THIS RUN HAS BEEN CHANGED FROM '
     .              ,F9.3,' TO ',F9.3/'0','THE TRAILING EDGE OF THE ',
     .                                    'LAST PULSE WAS GREATER THAN '
     .                                   ,'THE PROBLEM TIME')
C
C
      END
